| 1 | |
| 2 | [[PageOutline(3-4, Sections)]] |
| 3 | |
| 4 | == !SubtitlesVote == |
| 5 | |
| 6 | |
| 7 | === Intro === |
| 8 | |
| 9 | rate subtitles |
| 10 | |
| 11 | ---- |
| 12 | === Description === |
| 13 | |
| 14 | '''struct !SubtitlesVote(string $token, struct('idsubtitle' => int $idsubtitle, 'score' => int $score) $vote)''' |
| 15 | |
| 16 | allows registered users to rate subtitle ''idsubtitle'' giving a score ''score'' where 1 is worst and 10 is best. |
| 17 | |
| 18 | users cannot rate subtitles they uploaded and each user can rate a specific subtitle only once. |
| 19 | |
| 20 | |
| 21 | ---- |
| 22 | === Parameters === |
| 23 | |
| 24 | Parameters structure: |
| 25 | {{{ |
| 26 | struct( |
| 27 | (string) [token], |
| 28 | struct( |
| 29 | (string) [idsubtitle], |
| 30 | (double) [score] |
| 31 | ) |
| 32 | ) |
| 33 | }}} |
| 34 | |
| 35 | ''token (required)'':: |
| 36 | token string identifying user's session, taken from [wiki:XmlRpcLogIn LogIn] output structure. |
| 37 | ''vote (required)'':: |
| 38 | structure to rate (cast a vote) a subtitle contains: |
| 39 | * ''idsubtitle'': id of subtitle (NOT subtitle file) user wants to rate |
| 40 | * ''score'': subtitle rating, must be in interval 1 (worst) to 10 (best). |
| 41 | |
| 42 | |
| 43 | ---- |
| 44 | === Return Values === |
| 45 | |
| 46 | Output is returned in this structure: |
| 47 | {{{ |
| 48 | struct( |
| 49 | (string) [status], |
| 50 | struct( |
| 51 | (string) [SubRating], |
| 52 | (string) [SubSumVotes], |
| 53 | (string) [IDSubtitle] |
| 54 | ) [data], |
| 55 | (double) [seconds] |
| 56 | ) |
| 57 | }}} |
| 58 | |
| 59 | and contains these elements: |
| 60 | ''status'':: |
| 61 | function result code, see [wiki:XmlRpcStatusCode list of status codes] |
| 62 | ''data'':: |
| 63 | * ''!SubRating'': average subtitle rating for given subtitles |
| 64 | * ''!SubSumVotes'': number of times these subtitles were rated. |
| 65 | * ''IDSubtitle'': ID of subtitle in the database (BEWARE this is not the ID of subtitle file but the whole subtitle) |
| 66 | ''seconds'':: |
| 67 | time taken to execute this command on server |
| 68 | |
| 69 | |
| 70 | ---- |
| 71 | === Implementations === |
| 72 | |
| 73 | There are currently no available sample implementations. |
| 74 | |
| 75 | |
| 76 | ---- |
| 77 | === Changelog === |
| 78 | |
| 79 | Version 1: created this function |
| 80 | |
| 81 | |
| 82 | ---- |
| 83 | === Examples === |
| 84 | |
| 85 | |
| 86 | ==== Input ==== |
| 87 | |
| 88 | {{{ |
| 89 | #!xml |
| 90 | <methodCall> |
| 91 | <methodName>SubtitlesVote</methodName> |
| 92 | <params> |
| 93 | <param> |
| 94 | <value><string>e13niph67doilhse1me3kb43e4</string></value> |
| 95 | </param> |
| 96 | <param> |
| 97 | <value> |
| 98 | <struct> |
| 99 | <member> |
| 100 | <name>idsubtitle</name> |
| 101 | <value><int>3337934</int></value> |
| 102 | </member> |
| 103 | <member> |
| 104 | <name>score</name> |
| 105 | <value><int>10</int></value> |
| 106 | </member> |
| 107 | </struct> |
| 108 | </value> |
| 109 | </param> |
| 110 | </params> |
| 111 | </methodCall> |
| 112 | }}} |
| 113 | |
| 114 | |
| 115 | ==== Output ==== |
| 116 | |
| 117 | {{{ |
| 118 | #!xml |
| 119 | <methodResponse> |
| 120 | <params> |
| 121 | <param> |
| 122 | <value> |
| 123 | <struct> |
| 124 | <member> |
| 125 | <name>status</name> |
| 126 | <value><string>200 OK</string></value> |
| 127 | </member> |
| 128 | <member> |
| 129 | <name>data</name> |
| 130 | <value> |
| 131 | <struct> |
| 132 | <member> |
| 133 | <name>SubRating</name> |
| 134 | <value><string>10.0</string></value> |
| 135 | </member> |
| 136 | <member> |
| 137 | <name>SubSumVotes</name> |
| 138 | <value><string>1</string></value> |
| 139 | </member> |
| 140 | <member> |
| 141 | <name>IDSubtitle</name> |
| 142 | <value><string>3337934</string></value> |
| 143 | </member> |
| 144 | </struct> |
| 145 | </value> |
| 146 | </member> |
| 147 | <member> |
| 148 | <name>seconds</name> |
| 149 | <value><double>5.243</double></value> |
| 150 | </member> |
| 151 | </struct> |
| 152 | </value> |
| 153 | </param> |
| 154 | </params> |
| 155 | </methodResponse> |
| 156 | }}} |
| 157 | |
| 158 | |
| 159 | ---- |
| 160 | === Notes === |
| 161 | |
| 162 | none yet |
| 163 | |
| 164 | |
| 165 | ---- |
| 166 | === See also === |
| 167 | |
| 168 | |
| 169 | ---- |
| 170 | === Comments === |
| 171 | |
| 172 | add your comments, hints and suggestions here if you like ... |
| 173 | |
| 174 | |
| 175 | -------- |
| 176 | [Prev] [wiki:XmlRpcIntro Home] [Next] |